//
//  HSQSelectGroupGoodsListFooterView.m
//  LiTianDecoration
//
//  Created by administrator on 2018/6/14.
//  Copyright © 2018年 administrator. All rights reserved.
//

#import "HSQSelectGroupGoodsListFooterView.h"

@interface HSQSelectGroupGoodsListFooterView ()

@property (nonatomic, strong) UIView *LineView;

@property (nonatomic, strong) UIButton *Delete_Button;

@property (nonatomic, strong) UIButton *Mobile_Button;

@property (nonatomic, strong) UIButton *Promotion_Button;

@end

@implementation HSQSelectGroupGoodsListFooterView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        
        // 分割线
        UIView *LineView = [[UIView alloc] init];
        LineView.backgroundColor = KViewBackGroupColor;
        [self.contentView addSubview:LineView];
        self.LineView = LineView;
        
        // 删除按钮
        UIButton *Delete_Button = [self SetUpButtonWithTitle:@"删除"];
        [Delete_Button addTarget:self action:@selector(Delete_ButtonClickAction:) forControlEvents:(UIControlEventTouchUpInside)];
        self.Delete_Button = Delete_Button;
        
        // 移动按钮
        UIButton *mobile_Button = [self SetUpButtonWithTitle:@"移动"];
        [mobile_Button addTarget:self action:@selector(mobile_ButtonClickAction:) forControlEvents:(UIControlEventTouchUpInside)];
        self.Mobile_Button = mobile_Button;
        
        // 立即推广按钮
        UIButton *Promotion_Button = [self SetUpButtonWithTitle:@"立即推广"];
        [Promotion_Button addTarget:self action:@selector(Promotion_ButtonClickAction:) forControlEvents:(UIControlEventTouchUpInside)];
        self.Promotion_Button = Promotion_Button;
        
        // 分割线
        self.LineView.sd_layout.leftSpaceToView(self.contentView, 0).topSpaceToView(self.contentView, 0).rightSpaceToView(self.contentView, 0).heightIs(1);
        
        // 立即推广按钮
        self.Promotion_Button.sd_layout.rightSpaceToView(self.contentView, 10).centerYEqualToView(self.contentView).widthIs(80).heightIs(25);
        [self.Promotion_Button setSd_cornerRadius:@(5)];

        // 移动按钮
        self.Mobile_Button.sd_layout.rightSpaceToView(self.Promotion_Button, 10).centerYEqualToView(self.contentView).widthIs(60).heightRatioToView(self.Promotion_Button, 1.0);
        [self.Mobile_Button setSd_cornerRadius:@(5)];
        
        //删除按钮
        self.Delete_Button.sd_layout.rightSpaceToView(self.Mobile_Button, 10).centerYEqualToView(self.contentView).widthIs(60).heightRatioToView(self.Promotion_Button, 1.0);
        [self.Delete_Button setSd_cornerRadius:@(5)];

    }
    
    return self;
}

/**
 * @brief 初始化Btn
 */
- (UIButton *)SetUpButtonWithTitle:(NSString *)title{
    
    UIButton *btn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    
    [btn setTitle:title forState:(UIControlStateNormal)];
    
    [btn setTitleColor:RGB(71, 71, 71) forState:(UIControlStateNormal)];
    
    btn.titleLabel.font = [UIFont systemFontOfSize:12.0];
    
    btn.layer.borderWidth = 1;
    
    btn.layer.borderColor = RGB(71, 71, 71).CGColor;
    
    [self.contentView addSubview:btn];
    
    return btn;
}

/**
 * @brief 删除按钮
 */
- (void)Delete_ButtonClickAction:(UIButton *)sender{
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(DeleteItemsFromTheInventory:)]) {
        
        [self.delegate DeleteItemsFromTheInventory:sender];
    }
}

/**
 * @brief 移动按钮
 */
- (void)mobile_ButtonClickAction:(UIButton *)sender{
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(MoveItemsFromTheInventory:)]) {
        
        [self.delegate MoveItemsFromTheInventory:sender];
    }
}

/**
 * @brief 立即推广按钮
 */
- (void)Promotion_ButtonClickAction:(UIButton *)sender{
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(ImmediatelyPromoteTheProductsInTheSelectionBank:)]) {
        
        [self.delegate ImmediatelyPromoteTheProductsInTheSelectionBank:sender];
    }
}






@end
